package com.example.livedatatest;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class ViewModelWithLiveData extends ViewModel {
    public MutableLiveData<Integer> likednum;
    public MutableLiveData<Integer> getLikednum() {
        if (likednum == null){
            likednum = new MutableLiveData<>();
            likednum.setValue(0);
        }
        return likednum;
    }


    public void addnunm(int n){
        likednum.setValue(likednum.getValue()+n);
    }
}
